package com.n9.qqonline.start;

import com.n9.qqonline.sales.entity.User;
import com.n9.qqonline.sales.service.FormService;
import com.n9.qqonline.sales.service.UserService;
import com.n9.qqonline.sales.view.LoginForm;

import java.io.File;
import java.util.Objects;

/**
 * 程序启动方法
 * @author ice
 * @since 2019/1/29 15:34
 */
public class Launcher {
    public static void main(String[] args) throws Exception {
        Initializer.init();
//        BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.osLookAndFeelDecorated;
//        BeautyEyeLNFHelper.launchBeautyEyeLNF();

        LoginForm loginForm = new LoginForm((user)->{
            new UserService().saveOrUpdate(user);

            //显示主窗口
            FormService formService = new FormService();
            formService.initView();
            formService.openMainForm();
        });
        loginForm.setVisible(true);
        User user = new UserService().getUser();
        if (Objects.nonNull(user)) {
            loginForm.setUser(user);
        }
    }
}
